﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
    xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:sys="clr-namespace:System;assembly=mscorlib">

    <!-- BACKGROUND -->
    <LinearGradientBrush
        x:Key="DefaultGradientBackground"
        EndPoint="0,1"
        StartPoint="0,0"
        PresentationOptions:Freeze="True">
        <GradientStop
            Color="WhiteSmoke"
            Offset="0.0" />
        <GradientStop
            Color="AliceBlue"
            Offset="0.2" />
        <GradientStop
            Color="WhiteSmoke"
            Offset="1.0" />
    </LinearGradientBrush>
    <LinearGradientBrush
        x:Key="GrayGradientBackground"
        EndPoint="0,1"
        StartPoint="0,0"
        PresentationOptions:Freeze="True">
        <GradientStop
            Color="#AAA"
            Offset="0.0" />
        <GradientStop
            Color="#BBB"
            Offset="0.5" />
        <GradientStop
            Color="#BFBFBF"
            Offset="1.0" />
    </LinearGradientBrush>
    <LinearGradientBrush
        x:Key="DarkGradientBackground"
        EndPoint="0,1"
        StartPoint="0,0"
        PresentationOptions:Freeze="True">
        <GradientStop
            Color="#10105D"
            Offset="0.0" />
        <GradientStop
            Color="#5262AE"
            Offset="0.4" />
        <GradientStop
            Color="#7079A4"
            Offset="1.0" />
    </LinearGradientBrush>

    <!-- COLORS -->
    <SolidColorBrush
        x:Key="DefaultForegroundColor"
        Color="#FF272727"
        PresentationOptions:Freeze="True" />
    <SolidColorBrush
        x:Key="BorderColor"
        Color="#777"
        PresentationOptions:Freeze="True" />

    <!-- LEVEL COLORS -->
    <SolidColorBrush
        x:Key="DebugLevelColor"
        Color="LightBlue"
        PresentationOptions:Freeze="True" />
    <SolidColorBrush
        x:Key="InfoLevelColor"
        Color="LightGreen"
        PresentationOptions:Freeze="True" />
    <SolidColorBrush
        x:Key="WarnLevelColor"
        Color="Moccasin"
        PresentationOptions:Freeze="True" />
    <SolidColorBrush
        x:Key="ErrorLevelColor"
        Color="Salmon"
        PresentationOptions:Freeze="True" />
    <SolidColorBrush
        x:Key="FatalLevelColor"
        Color="Crimson"
        PresentationOptions:Freeze="True" />

    <!-- IMAGES -->
    <BitmapImage
        x:Key="imgWindowIcon"
        PresentationOptions:Freeze="True"
        UriSource="Icons/app.ico" />

    <!-- FONT -->
    <FontFamily
        x:Key="DefaultFontFamily">
        <!--Arial-->
        <!--Calibri-->
        <!--Georgia-->
        <!--Helvetica-->
        <!--Lucida Sans-->
        Segoe UI
        <!--Times New Roman-->
        <!--Verdana-->
    </FontFamily>

    <!-- FONTSIZE -->
    <sys:Double
        x:Key="DefaultFontSize">12</sys:Double>

    <!-- WINDOW -->
    <Style
        x:Key="DefaultWindowStyle"
        TargetType="{x:Type Window}">
        <Setter
            Property="Control.FontFamily"
            Value="{StaticResource DefaultFontFamily}" />
        <Setter
            Property="Control.FontSize"
            Value="{StaticResource DefaultFontSize}" />
        <Setter
            Property="UseLayoutRounding"
            Value="True" />
        <Setter
            Property="TextOptions.TextFormattingMode"
            Value="Display" />
        <Setter
            Property="TextOptions.TextRenderingMode"
            Value="ClearType" />
        <Setter
            Property="RenderOptions.BitmapScalingMode"
            Value="Linear" />
        <Setter
            Property="Background"
            Value="{StaticResource DefaultGradientBackground}" />
        <Setter
            Property="Foreground"
            Value="{StaticResource DefaultForegroundColor}" />
        <Setter
            Property="Window.ResizeMode"
            Value="CanResizeWithGrip" />
        <Setter
            Property="Window.Icon"
            Value="{StaticResource imgWindowIcon}" />
    </Style>

    <Style
        x:Key="DefaultBorderStyle"
        TargetType="{x:Type Border}">
        <Setter
            Property="BorderBrush"
            Value="{StaticResource BorderColor}" />
        <Setter
            Property="BorderThickness"
            Value="1" />
        <Setter
            Property="CornerRadius"
            Value="3" />
    </Style>

    <!-- TOOLBAR -->
    <Style
        x:Key="DefaultToolbarStyle"
        TargetType="{x:Type ToolBar}">
        <Setter
            Property="ToolBarTray.IsLocked"
            Value="True" />
        <Setter
            Property="FocusManager.IsFocusScope"
            Value="False" />
        <Setter
            Property="Background"
            Value="Transparent">
        </Setter>
        <Setter
            Property="FontSize"
            Value="{StaticResource DefaultFontSize}" />
        <Setter
            Property="BorderThickness"
            Value="0" />
    </Style>

    <!-- GRIDSPLITTER -->
    <Style
        x:Key="DefaultGridSplitterStyle"
        TargetType="GridSplitter">
        <Setter
            Property="Background"
            Value="#15000000" />
        <Setter
            Property="BorderBrush"
            Value="Silver" />
        <Style.Triggers>
            <Trigger
                Property="ResizeDirection"
                Value="Columns">
                <Setter
                    Property="BorderThickness"
                    Value="1" />
                <Setter
                    Property="Width"
                    Value="5" />
            </Trigger>
            <Trigger
                Property="ResizeDirection"
                Value="Rows">
                <Setter
                    Property="BorderThickness"
                    Value="0,1" />
                <Setter
                    Property="Height"
                    Value="5" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- DATAGRID -->
    <Style
        x:Key="DefaultDataGridStyle"
        TargetType="{x:Type DataGrid}">
        <Setter
            Property="Background"
            Value="Transparent" />
        <Setter
            Property="BorderThickness"
            Value="0" />
        <Setter
            Property="RowHeight"
            Value="20" />
        <Setter
            Property="IsReadOnly"
            Value="True" />
        <Setter
            Property="HeadersVisibility"
            Value="Column" />
        <Setter
            Property="VerticalGridLinesBrush"
            Value="#8C6C6C6C" />
        <Setter
            Property="HorizontalGridLinesBrush"
            Value="White" />
        <Setter
            Property="AutoGenerateColumns"
            Value="False" />
        <Setter
            Property="SelectionMode"
            Value="Extended" />
        <Setter
            Property="SelectionUnit"
            Value="FullRow" />
        <Setter
            Property="CanUserAddRows"
            Value="False" />
        <Setter
            Property="CanUserDeleteRows"
            Value="False" />
        <Setter
            Property="CanUserReorderColumns"
            Value="False" />
        <Setter
            Property="CanUserResizeColumns"
            Value="True" />
        <Setter
            Property="CanUserSortColumns"
            Value="True" />
        <Setter
            Property="ClipboardCopyMode"
            Value="ExcludeHeader" />
        <Setter
            Property="Foreground"
            Value="{StaticResource DefaultForegroundColor}" />
        <Style.Triggers>
            <Trigger
                Property="HeadersVisibility"
                Value="Column">
                <!-- Workaround datagrid bug; refs: http://wpf.codeplex.com/discussions/47047 -->
                <Setter
                    Property="RowHeaderWidth"
                    Value="0" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style
        x:Key="DefaultColumnHeaderGripperStyle"
        TargetType="{x:Type Thumb}">
        <Setter
            Property="Width"
            Value="8" />
        <Setter
            Property="Background"
            Value="Transparent" />
        <Setter
            Property="Cursor"
            Value="SizeWE" />
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="{x:Type Thumb}">
                    <Border
                        Background="{TemplateBinding Background}"
                        Padding="{TemplateBinding Padding}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style
        x:Key="DefaultDataGridHeaderStyle"
        TargetType="{x:Type DataGridColumnHeader}">
        <Setter
            Property="VerticalContentAlignment"
            Value="Center" />
        <Setter
            Property="HorizontalContentAlignment"
            Value="Center" />
        <Setter
            Property="BorderThickness"
            Value="0,0,1,1" />
        <Setter
            Property="BorderBrush"
            Value="{StaticResource BorderColor}" />
        <Setter
            Property="Background"
            Value="{StaticResource GrayGradientBackground}" />
        <Setter
            Property="Foreground"
            Value="{StaticResource DefaultForegroundColor}" />
        <Setter
            Property="FontWeight"
            Value="Bold" />
        <Setter
            Property="FontSize"
            Value="11" />
        <Setter
            Property="Height"
            Value="20" />
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="{x:Type DataGridColumnHeader}">
                    <Grid>
                        <Themes:DataGridHeaderBorder
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            IsClickable="{TemplateBinding CanUserSort}"
                            IsPressed="{TemplateBinding IsPressed}"
                            IsHovered="{TemplateBinding IsMouseOver}"
                            Padding="{TemplateBinding Padding}"
                            SortDirection="{TemplateBinding SortDirection}"
                            SeparatorBrush="{TemplateBinding SeparatorBrush}"
                            SeparatorVisibility="{TemplateBinding SeparatorVisibility}">
                            <Grid>
                                <ContentPresenter
                                    x:Name="PART_ContentPresenter"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                <Path
                                    x:Name="SortArrow"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Center"
                                    Margin="2,1,2,0"
                                    Width="8"
                                    Height="6"
                                    Stretch="Fill"
                                    Opacity="0.5"
                                    Fill="White"
                                    RenderTransformOrigin="0.5,0.4"
                                    Visibility="Collapsed"
                                    Data="M0,0 L1,0 0.5,1 z" />
                            </Grid>
                        </Themes:DataGridHeaderBorder>
                        <Thumb
                            x:Name="PART_LeftHeaderGripper"
                            HorizontalAlignment="Left"
                            Style="{StaticResource DefaultColumnHeaderGripperStyle}" />
                        <Thumb
                            x:Name="PART_RightHeaderGripper"
                            HorizontalAlignment="Right"
                            Style="{StaticResource DefaultColumnHeaderGripperStyle}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger
                            Property="HorizontalContentAlignment"
                            Value="Left">
                            <Setter
                                TargetName="PART_ContentPresenter"
                                Property="Margin"
                                Value="3,0,0,0" />
                        </Trigger>
                        <Trigger
                            Property="HorizontalContentAlignment"
                            Value="Right">
                            <Setter
                                TargetName="PART_ContentPresenter"
                                Property="Margin"
                                Value="0,0,3,0" />
                        </Trigger>
                        <Trigger
                            Property="SortDirection"
                            Value="Ascending">
                            <Setter
                                TargetName="SortArrow"
                                Property="Visibility"
                                Value="Visible" />
                            <Setter
                                TargetName="SortArrow"
                                Property="RenderTransform">
                                <Setter.Value>
                                    <RotateTransform
                                        Angle="180" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger
                            Property="SortDirection"
                            Value="Descending">
                            <Setter
                                TargetName="SortArrow"
                                Property="Visibility"
                                Value="Visible" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style
        x:Key="DefaultDataGridCellStyle"
        TargetType="DataGridCell">
        <Style.Triggers>
            <Trigger
                Property="IsSelected"
                Value="True">
                <Setter
                    Property="Foreground"
                    Value="{StaticResource DefaultForegroundColor}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style
        x:Key="CenterDataGridCellStyle"
        BasedOn="{StaticResource DefaultDataGridCellStyle}"
        TargetType="DataGridCell">
        <Style.Setters>
            <Setter
                Property="TextBlock.TextAlignment"
                Value="Center" />
        </Style.Setters>
    </Style>

    <Style
        x:Key="LogItemDataGridRowStyle"
        TargetType="{x:Type DataGridRow}">
        <Style.Triggers>

            <!-- Debug -->
            <DataTrigger
                Binding="{Binding Path=LevelIndex, Mode=OneWay}"
                Value="1">
                <Setter
                    Property="Background"
                    Value="{StaticResource DebugLevelColor}" />
            </DataTrigger>

            <!-- Info -->
            <DataTrigger
                Binding="{Binding Path=LevelIndex, Mode=OneWay}"
                Value="2">
                <Setter
                    Property="Background"
                    Value="{StaticResource InfoLevelColor}" />
            </DataTrigger>

            <!-- Warn -->
            <DataTrigger
                Binding="{Binding Path=LevelIndex, Mode=OneWay}"
                Value="3">
                <Setter
                    Property="Background"
                    Value="{StaticResource WarnLevelColor}" />
            </DataTrigger>

            <!-- Error -->
            <DataTrigger
                Binding="{Binding Path=LevelIndex, Mode=OneWay}"
                Value="4">
                <Setter
                    Property="Background"
                    Value="{StaticResource ErrorLevelColor}" />
            </DataTrigger>

            <!-- Fatal -->
            <DataTrigger
                Binding="{Binding Path=LevelIndex, Mode=OneWay}"
                Value="5">
                <Setter
                    Property="Background"
                    Value="{StaticResource FatalLevelColor}" />
            </DataTrigger>

        </Style.Triggers>
    </Style>

    <!-- RADIO BUTTONS -->

    <Style
        x:Key="tbRbStyle"
        TargetType="TextBlock">
        <Setter
            Property="Margin"
            Value="0,0,0,0" />
        <Setter
            Property="FontSize"
            Value="11" />
        <Setter
            Property="Foreground"
            Value="{StaticResource DefaultForegroundColor}" />
        <Setter
            Property="VerticalAlignment"
            Value="Center" />
        <Setter
            Property="FontWeight"
            Value="Normal" />
        <Setter
            Property="TextAlignment"
            Value="Center" />
    </Style>

    <Style
        x:Key="borderRbStyle"
        BasedOn="{StaticResource DefaultBorderStyle}"
        TargetType="Border">
        <Setter
            Property="MinWidth"
            Value="50" />
        <Setter
            Property="Padding"
            Value="3" />
    </Style>

    <Border
        Style="{StaticResource borderRbStyle}"
        x:Key="RadioButtonAll"
        Background="Transparent">
        <DockPanel
            LastChildFill="True">
            <RadioButton
                DockPanel.Dock="Left"
                GroupName="Selection"
                IsChecked="{Binding Path=SelectAll}">
                <TextBlock
                    Style="{StaticResource tbRbStyle}"
                    Text="ALL" />
            </RadioButton>
        </DockPanel>
    </Border>

    <Border
        Style="{StaticResource borderRbStyle}"
        x:Key="RadioButtonDebug"
        Background="{StaticResource DebugLevelColor}">
        <DockPanel
            LastChildFill="True">
            <RadioButton
                DockPanel.Dock="Left"
                GroupName="Selection"
                IsChecked="{Binding Path=SelectDebug}">
                <TextBlock
                    VerticalAlignment="Center"
                    Style="{StaticResource tbRbStyle}"
                    Text="DEBUG" />

            </RadioButton>
        </DockPanel>
    </Border>

    <Border
        Style="{StaticResource borderRbStyle}"
        x:Key="RadioButtonInfo"
        Background="{StaticResource InfoLevelColor}">
        <DockPanel
            LastChildFill="True">
            <RadioButton
                DockPanel.Dock="Left"
                GroupName="Selection"
                IsChecked="{Binding Path=SelectInfo}">
                <TextBlock
                    Style="{StaticResource tbRbStyle}"
                    Text="INFO" />
            </RadioButton>
        </DockPanel>
    </Border>

    <Border
        Style="{StaticResource borderRbStyle}"
        x:Key="RadioButtonWarn"
        Background="{StaticResource WarnLevelColor}">
        <DockPanel
            LastChildFill="True">
            <RadioButton
                DockPanel.Dock="Left"
                GroupName="Selection"
                IsChecked="{Binding Path=SelectWarn}">
                <TextBlock
                    Style="{StaticResource tbRbStyle}"
                    Text="WARN" />
            </RadioButton>
        </DockPanel>
    </Border>

    <Border
        Style="{StaticResource borderRbStyle}"
        x:Key="RadioButtonError"
        Background="{StaticResource ErrorLevelColor}">
        <DockPanel
            LastChildFill="True">
            <RadioButton
                DockPanel.Dock="Left"
                GroupName="Selection"
                IsChecked="{Binding Path=SelectError}">
                <TextBlock
                    Style="{StaticResource tbRbStyle}"
                    Text="ERROR" />
            </RadioButton>
        </DockPanel>
    </Border>

    <Border
        Style="{StaticResource borderRbStyle}"
        x:Key="RadioButtonFatal"
        Background="{StaticResource FatalLevelColor}">
        <DockPanel
            LastChildFill="True">
            <RadioButton
                DockPanel.Dock="Left"
                GroupName="Selection"
                IsChecked="{Binding Path=SelectFatal}">
                <TextBlock
                    Style="{StaticResource tbRbStyle}"
                    Text="FATAL" />
            </RadioButton>
        </DockPanel>
    </Border>

    <!-- ROUND TEXTBOX -->
    <Style
        x:Key="RoundWatermarkTextBox"
        TargetType="{x:Type TextBox}">
        <Setter
            Property="Height"
            Value="21" />
        <Setter
            Property="AllowDrop"
            Value="True" />
        <Setter
            Property="Background"
            Value="Transparent" />
        <Setter
            Property="HorizontalContentAlignment"
            Value="Stretch" />
        <Setter
            Property="VerticalContentAlignment"
            Value="Stretch" />
        <Setter
            Property="VerticalAlignment"
            Value="Center" />
        <Setter
            Property="FontFamily"
            Value="{StaticResource DefaultFontFamily}" />
        <Setter
            Property="FontStyle"
            Value="Italic" />
        <Setter
            Property="FontWeight"
            Value="Normal" />
        <Setter
            Property="FontSize"
            Value="{StaticResource DefaultFontSize}" />
        <Setter
            Property="AcceptsReturn"
            Value="True" />
        <Setter
            Property="Padding"
            Value="5,3,3,3" />
        <Setter
            Property="BorderThickness"
            Value="0" />
        <Setter
            Property="Margin"
            Value="1,0,1,0" />
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="{x:Type TextBox}">
                    <Grid>
                        <Border
                            x:Name="BorderBase"
                            Background="WhiteSmoke"
                            BorderBrush="Gray"
                            BorderThickness="1.4,1.4,1,1"
                            CornerRadius="5" />
                        <Label
                            x:Name="TextPrompt"
                            Content="{TemplateBinding Tag}"
                            Padding="5,3,3,3"
                            Focusable="False"
                            FontStyle="Oblique"
                            Foreground="Gray"
                            Visibility="Collapsed" />
                        <ScrollViewer
                            x:Name="PART_ContentHost"
                            Margin="0"
                            Foreground="{DynamicResource OutsideFontColor}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition
                                    Property="IsFocused"
                                    Value="False" />
                                <Condition
                                    Property="Text"
                                    Value="" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter
                                    Property="Visibility"
                                    TargetName="TextPrompt"
                                    Value="Visible" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                        <Trigger
                            Property="IsFocused"
                            Value="True">
                            <Setter
                                Property="BorderBrush"
                                TargetName="BorderBase"
                                Value="LightGreen" />
                        </Trigger>
                        <Trigger
                            Property="IsEnabled"
                            Value="False">
                            <Setter
                                Property="Foreground"
                                Value="DimGray" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>